﻿ <%--
  *  File:    BunchnoManage.jsp
  *  @Author: KevinFan
  *  Date:    2011/8/2
  *
  *  Copyright (C) 2000 - 2012 Oval Technologies, Inc.
  *  All rights reserved.
  *
  *  This software is the confidential and proprietary information of Oval
  *  Technologies, Inc. ("Confidential Information").  You shall not
  *  disclose such Confidential Information and shall use it only in
  *  accordance with the terms of the license agreement you entered into
  *  with Oval.
 --%>
<%@ page import="java.text.DecimalFormat" %>
<%@ page import="java.lang.*" %>
<%@ page contentType = "text/html;charset=UTF-8" %>

 <%
   Category cat = Category.getInstance("jsp.BunchnoManage");
   String strModuleName = "TDR";
   String privilegeCode = "A0501";
   String contextPath = request.getContextPath();
 %>
 <%@ include file="/inc/CommonHeader.inc" %>
 <%@ include file="/inc/OvalLocationDefault.inc" %>
 <%@ include file="/rpt/ReportURL.inc" %>
 <html>
 <iframe name="summaryfrm" scrolling="no" frameborder="0" style="position:absolute; top:0px; left:0px; display:none;border:#909eff 1px solid;"></iframe>
 <head>
 <title>CustomerCollateEdit</title>
 <PageFlow:CheckPageFlow pageName="p_getbunchnodetailsummary"/>
 <%@ include file="/inc/CatchError.inc" %>
 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
 <script language="JavaScript" src="<%=contextPath %>/js/ScriptLib.js"></script>
 <script language="JavaScript" src="<%=contextPath %>/js/SummaryDivision.js"></script>
 <link rel="stylesheet" href="<%=contextPath %>/css/<%= strLanguageCode %>/main.css" type="text/css">
 <script language="JavaScript" src="<%=contextPath %>/css/<%= strLanguageCode %>/script.js"></script>
 <script language="JavaScript" src="<%=contextPath %>/js/Calendar.js"></script>
 <script language="JavaScript" src="<%=contextPath %>/js/FuncLib.js"></script>
 <script language="JavaScript" src="<%=contextPath %>/js/opal2/mootools.js"></script>
 <%@ include file="/inc/SummaryDivision.inc" %>
 <%@ include file="/inc/NewCalendar.inc" %>
 <%
 HashMap userinfo = (HashMap) session.getAttribute("userinfo");
   Integer  issalesman = (Integer) userinfo.get("issalesman");
   Vector totalsummary = (Vector)pageContext.getAttribute("totalsummary");
   if(totalsummary == null)totalsummary = new Vector();
   
 %>
<script>
function page_summary(actionvalue,orderbyname)
{
  var editform = summaryPrepare(cform,actionvalue,orderbyname);
  if(!editform) return;
  editform.action = "BunchnoManage.jsp?<%= OvalTools.randomURL() %>";
  editform.target = "_self";
  isRunning = true;
  editform.submit();
}

function page_save(){
  if(!checkForm(document.cform))return;
  if(pageflag==1){
	alert("请填写正确格式的批号密码！");
	return;
  }
  if(porsflag==1){
		alert("请填写正确格式的密码/监管码！");
		return;
  }
  cform.actionname.value = "save";
  cform.target = "_self";
  isRunning = true;
  document.cform.submit();
}

function page_delete(){
  if(isNullChecked(cform.deleteids)) 
  {
    alert('<%=message.getMessageDesc("PLEASE_SELECT")%>');
    return;
  }
  for(var i=0;i<cform.deleteids.length;i++){
		var n = i + 1;
		if(cform.deleteids[i].checked){
			if(eval('cform.batchnoype'+n).value == 1)
				{
				alert('物流类型为"公司出货"不能删除,请重新选择！');
				return;
				}
		}
  }
  if(!confirm("确定删除所选记录吗？"))return;
  cform.actionname.value = "delete";
  cform.target = "_self";
  isRunning = true;
  document.cform.submit();
}
var pageflag;
var porsflag;
var popwindow;
var switchtype;
 
function setOrg(id,name,code)
{
	if(switchtype==1){
		cform.sershipfrom.value=id;
		cform.sershipfromcode.value=code;
		cform.sershipfromname.value=name;
	}else if(switchtype==2){
		cform.sershipto.value=id;
		cform.sershiptocode.value=code;
		cform.sershiptoname.value=name;
	}else if(switchtype==4){
		cform.shipfrom.value=id;
		cform.shipfromcode.value=code;
		cform.shipfromname.value=name;
	}else if(switchtype==5){
		cform.shipto.value=id;
		cform.shiptocode.value=code;
		cform.shiptoname.value=name;
	}
	hiddenFrm();
}

function page_setProduct(id,code,name,price,spec){	
	if(switchtype==3){
		cform.serproductid.value=id;
		cform.serproductcode.value=code;
		cform.serproductname.value=name;
	}else if(switchtype==6){
		cform.productid.value=id;
		cform.productcode.value=code;
		cform.productname.value=name;
	}
	hiddenFrm();
}

var isHidden;
function frm_select(e,flag){
	switchtype=flag;
	isHidden = "block";
	var _target = getPosition(e);
    var _obj = document.getElementById("summaryfrm");
    _obj.style.left = _target.x;
    _obj.style.top = _target.y + e.clientHeight;
    _obj.style.height="250px";
    _obj.style.width="530px";
    _obj.style.zIndex = 5000;
    _obj.style.display = "block";
	var strUrl = "";	
	if(flag==1 || flag==4){
		strUrl = "<%=contextPath %>/tdr/datatypein/OrgSelectPop.jsp?maxitem=8&globalpccode=1&<%= OvalTools.randomURL() %>";
	}else if(flag==2 || flag==5){
		if(flag==5)_obj.style.left = _target.x-530;
		strUrl = "<%=contextPath %>/tdr/datatypein/OrgSelectPop.jsp?maxitem=8&globalpccode=2&<%= OvalTools.randomURL() %>";
	}else if(flag==3 || flag==6){
		_obj.style.height="300px";
		strUrl = "<%=contextPath %>/tdr/datatypein/ProdSelectPop.jsp?maxitem=10&<%= OvalTools.randomURL() %>";
	}
    document.summaryfrm.location.href = strUrl;
}
function getPosition(e) {
        var left = 0;
        var top = 0;
        while (e.offsetParent) {
            left += e.offsetLeft + (e.curentStyle? (parseInt(e.curentStyle.borderLeftWidth).NaN0()):0);
            top += e.offsetTop + (e.curentStyle ? (parseInt(e.curentStyle.borderTopWidth)).NaN0() : 0);
            e = e.offsetParent;
        }
        left += e.offsetLeft + (e.curentStyle ? (parseInt(e.curentStyle.borderLeftWidth)).NaN0() : 0);
        top += e.offsetTop + (e.curentStyle ? (parseInt(e.curentStyle.borderTopWidth)).NaN0() : 0);
        return {x:left, y:top};
}
function closeItemSelect(evt)
{
	var _obj = document.getElementById("summaryfrm");
	if(isHidden == "block"){
		isHidden = "none";
	}else{
		_obj.style.display = "none";
	}
	evt = evt || window.event;
        var _target = evt.target || evt.srcElement;
        if (!_target.getAttribute("Author") && _target != inputObj && _target != targetObj) {
            getObjById("Calendar").style.display = "none";
            getObjById("CalendarFrm").style.display = "none";
        }
}

function hiddenFrm(){
	document.getElementById("summaryfrm").style.display = "none";
}

document.onclick=closeItemSelect;   

//salesman
function popRep() {
	//var regionid=cform.regionid.value;
	//var proviceofficecode = document.cform.proviceofficelist.value;
	//var businessareacode = document.cform.businessarealist.value;
	//alert(regionid+"|"+proviceofficeid+"|"+areaid+"|");
	var status = "height=400, width=600, top=100, left=100, toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, status=no";
	var url = "<%=contextPath %>/tdr/dataverify/SalesPopWindow.jsp?<%= OvalTools.randomURL() %>";
	popwindow = window.open(url, "newwindow", status);
  }

function SetSalesMan(id,code,name){
	cform.userids.value=id;
	cform.employeecode.value=code;
	cform.employeename.value=name;
}

//getbusinessarea
function page_getpriviceoffice(){
	var objdeptcode=eval("cform.regionid");
	if (objdeptcode==""){
	    return;
	}
	var  datahandler = new  DataHandler();
	datahandler.add_params("regionid" , objdeptcode.value , "Integer");
	datahandler.getResultFromVector("resultproviceoffice","proviceofficename","proviceofficecode","document.cform.proviceofficelist");
	datahandler.add_job("j_doctorchufangliangdoc");
	datahandler.runDataHandler();
  }



function page_getbusinessarea(){
	var regionid = document.cform.regionid.value;
	var objdeptcode=eval("cform.proviceofficelist");
	if (objdeptcode==""){
	    return;
	}
	var  datahandler = new  DataHandler();
	datahandler.add_params("regionid" , regionid, "Integer");
	datahandler.add_params("proviceofficelist" , objdeptcode.value , "String");
	datahandler.getResultFromVector("resultbusinessarea","businessareaname","businessareacode","document.cform.businessarealist");
	datahandler.add_job("j_doctorchufangliangdoc");
	datahandler.runDataHandler();
 }

function page_allcheckselect(){
	var allcheck = cform.allcheck.checked;
	var alldatafile = document.getElementsByName('deleteids');
	var length = alldatafile.length;
	if(allcheck){
		for(var i = 1 ; i <= length;i++){
			if(!alldatafile[i-1].disabled){
			alldatafile[i-1].checked = true;}
		}
	}else{
		for(var i = 1 ; i <= length;i++){
			alldatafile[i-1].checked = false;
		}	
	}
}

function page_getError(){
	document.cform.errortype.value=0;
	itemcode = cform.itmecode.value;
	datacode = cform.datacodeF.value;
	shipto = cform.shipto.value;
	productid = cform.productid.value;
	datatype =  cform.datatype.value;
	flag=0;
	if(datacode==null || datacode=="")return;
	if(shipto==null || shipto=="" || productid==null || productid=="")return;
	var patrn = /^[0-9]{9}$/;
	if(patrn.exec(datacode)) { 
		flag=1;
	}
	var  datahandler = new  DataHandler();
	datahandler.add_params("itemcode" , itemcode, "String");
	datahandler.add_params("datacode" , datacode, "String");
	datahandler.add_params("shipto" , shipto, "String");
	datahandler.add_params("productid" , productid, "String");
	datahandler.add_params("datatype" , datatype, "String");
	datahandler.add_params("flag" , flag, "String");
	datahandler.getResultFromHashMap("errorhash","errortype","document.cform.errortype");
	datahandler.getResultFromHashMap("errorhash","datacode","document.cform.datacode");
	datahandler.add_job("j_checkbuncho");
	datahandler.runDataHandler();
	setTimeout("page_setError();",300);
 }
function page_setError(){
	if(document.cform.errortype.value==1){		
		document.getElementById("errorStr").innerHTML="<b style='color:red'>公司发货批号密码库中不存在这个批号密码，可能为假货!</b>";
	}
	if(document.cform.errortype.value==2){		
		document.getElementById("errorStr").innerHTML="<b style='color:red'>您录入的是省外批密!</b>";
	}
	if(document.cform.errortype.value==3){		
		document.getElementById("errorStr").innerHTML="<b style='color:red'>您录入的是省内批密!</b>";
	}
	datacode = cform.datacode.value;
	var patrn1 = /^[0-9]{16}$/;
	var patrn2 = /^[0-9]{20}$/;
	if(patrn1.exec(datacode) || patrn2.exec(datacode)) { 
		cform.itmecode.value=datacode.substr(0,5);
	}
}

function page_clear(){
	cform.employeename.value=""; cform.userids.value=""; cform.employeecode.value="";cform.sershipfrom.value=""; cform.sershipfromcode.value=""; cform.sershipfromname.value=""; cform.sershipto.value=""; cform.sershiptocode.value=""; cform.sershiptoname.value=""; cform.serdate1.value=""; cform.serdate2.value=""; cform.serproductid.value=""; cform.serproductcode.value=""; cform.serproductname.value="";
	cform.areaids.value="";cform.businessareaname.value="";
}
function popBusinessarea_moulty(){
	if(popwindow!=null) popwindow.close();
	
    url = '<%=contextPath %>/zyl/masterdata/map/SelectAreaTree.jsp?<%= OvalTools.randomURL() %>';
    attribute = 'height=540, width=250,top=100,left=100,toolbar=no, menubar=no, scrollbars=yes, resizable=no, location=no, status=no';
	popwindow = window.open(url,'newwindow', attribute);
}

function setAreas(areaids,areanames,areacodes){

	document.cform.areaids.value = areaids;
	document.cform.businessareaname.value = areanames;
	//document.cform.businessareacode.value = areacodes;
} 
</script>
 </head>
 <body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
 <iframe id="reloadHandler" name="reloadHandler" style="display:none"></iframe>
 <form name="cform" method="post" action="<%=contextPath %>/Dispatcher"> 
	<input type="hidden" name="pagename" value="p_getbunchnodetailsummary">
    <input type="hidden" name="actionname"/>
	<input type="hidden" name="errortype"/>
	<input type="hidden" name="maker" value="<custom:write property="userid" name="userinfo" scope="session"/>"/>
 <%-- page location --%>
   <%@ include file="/inc/PageLocation.inc" %>
	   <table width="100%" cellspacing="0" cellpadding="0" border="0">
		<tr>
             <td>
				 <table width="100%" cellspacing="5" cellpadding="0" border="0">
					<%if(!"1".equals(issalesman)) {%>
						<tr>
							  <td width="5%" class="td_right">
						<%=label.getLabelName("L_BusinessAreaName") +  label.getLabelName("L_Colon") %>
						 </td>
						  <td width="20%" class="td_left"> <custom:hidden  property="areaids" />
					<custom:text  property="businessareaname"  label="L_BusinessAreaName" readonly="true"/>
					<a onclick="popBusinessarea_moulty()"><custom:button type="3" value="*"/></a>
		           </td>
		           <td width="5%" class="td_right"><%=label.getLabelName("L_BusinessContact") +  label.getLabelName("L_Colon") %></td>
							<td width="20%" class="td_left">
							<custom:text property="employeename" size="20" readonly="true" style="border:1px #7F9DB9 solid;"/>
							<a onClick="javascript:popRep();"><custom:button type="3" label="L_Asterisk" imgsrc="flash.gif" border="0"/></a> 
							<custom:hidden property="userids"/>
							<custom:hidden property="employeecode"/>
							</td>
					   </tr>
					   <%} %>
					   <tr>
                         <td class="td_right" width="5%"><%= "物流类型" + label.getLabelName("L_Colon") %></font></td>
                         <td class="td_left" width="20%">
                            <custom:selectdic dictType="LogisticsType" property="serbunchnotype" defaultValue="------" defaultValueCost=""/>
                         </td>			 
						 <td class="td_right" width="5%"><%= "出货方" + label.getLabelName("L_Colon") %></td>
                         <td class="td_left" width="20%">
                             <custom:hidden property="sershipfrom"/>
							 <custom:text property="sershipfromcode" size="10" readonly="true" />
                             <a onclick="javascript:javascript:frm_select(this,1);"><custom:button type="3" label="L_Asterisk" imgsrc="flash.gif" border="0"/></a>
                             <custom:text property="sershipfromname" size="15" readonly="true" />
                         </td>
						 <td class="td_right" width="5%"><%= "进货方" + label.getLabelName("L_Colon") %></td>
                         <td class="td_left" width="20%">
                             <custom:hidden property="sershipto"/>
							 <custom:text property="sershiptocode" size="10" readonly="true" />
                             <a onclick="javascript:javascript:frm_select(this,2);"><custom:button type="3" label="L_Asterisk" imgsrc="flash.gif" border="0"/></a>
                             <custom:text property="sershiptoname" size="15" readonly="true" />
                         </td>
                         <td class="td_right" width="5%"><%="包装类型" +  label.getLabelName("L_Colon") %></td>
						 <td class="td_left" width="20%">
							<custom:selectdic dictType="PackagType" property="serdetailtype" defaultValue="------" defaultValueCost=""/>
						 </td> 
                       </tr>
<%-----------------------第二行---------------------%>
                       <tr>
                         <td class="td_right"><%= "日期" + label.getLabelName("L_Colon") %></td>
                         <td class="td_left">
                            <custom:text property="serdate1" size="10" readonly="true"/>
							<a onclick="javascript:c.show(this,'cform.serdate1','yyyy-MM-dd')"><input type=button class="button3" value="*"></a>--
							<custom:text property="serdate2" size="10" readonly="true"/>
							<a onclick="javascript:c.show(this,'cform.serdate2','yyyy-MM-dd')"><input type=button class="button3" value="*"></a>
						</td>
						 <td class="td_right"><%= "产品" + label.getLabelName("L_Colon") %></td>
                         <td class="td_left">
                             <custom:hidden property="serproductid"/>
							 <custom:text property="serproductcode" size="10" readonly="true"/>
                             <a onclick="javascript:frm_select(this,3);"><custom:button type="3" label="L_Asterisk" imgsrc="flash.gif" border="0"/></a>
                             <custom:text property="serproductname" size="15" readonly="true"/>
                         </td>
						 <td class="td_right"><%="数量级别" +  label.getLabelName("L_Colon") %></td>
						 <td class="td_left">
							<custom:selectdic dictType="QuantityLevel" property="serqtytype" defaultValue="------" defaultValueCost=""/>&nbsp;&nbsp;
							<a href="javascript:page_summary('search')"><img src="/oval/images/cn/go.gif" border="0" ></a>&nbsp;&nbsp;
							<button type="button" onclick="page_clear()" class="button1" name="re" value="clear" style="width:60"><%=label.getLabelName("L_Clear") %>
						 </td>
						 <td class="td_left">	
						 </td>
                         <td colspan="3">
						  <table width="100%" cellspacing="0">
							<tr>
								<td class="td_right">
									<custom:button type="1" label="L_Delete" imgsrc="Delete.gif" border="0" onclick="page_delete();" style="width:40"/>
								</td>
							</tr>
						  </table></td>
                       </tr>
                 </table>
              </td>
           </tr>        
           <tr>
             <td colspan="2">
			 <div style="width:100%;height=250;overflow=auto;">
			  <table width="100%" border="1" cellpadding="0" bordercolorlight="#999999" bordercolordark="#FFFFFF" cellspacing="0" align="center">
                 <tr class="deepblue-left">
                   <td class="title_center"><input type="checkbox" name="allcheck" class="normalradio" onclick="page_allcheckselect();"></td>
                   <td class="title_center"><a href="javascript:page_summary('orderby','docdate')">日期</a></td>
                   <td class="title_center"><a href="javascript:page_summary('orderby','shipfromname')">出货方</a></td>
                   <td class="title_center"><a href="javascript:page_summary('orderby','shiptoname')">进货方</a></td>
                   <td class="title_center"><a href="javascript:page_summary('orderby','productname')">产品</a></td>
                   <td class="title_center"><a href="javascript:page_summary('orderby','spec')">产品规格</a></td>
                   <td class="title_center"><a href="javascript:page_summary('orderby','batchnoype')">物流类型</a></td>
                   <td class="title_center"><a href="javascript:page_summary('orderby','batchno')">批号</a></td>
                   <td class="title_center"><a href="javascript:page_summary('orderby','datacode')">密码/监管码</a></td>				   
				   <td class="title_center"><a href="javascript:page_summary('orderby','datatype')">包装类型</a></td>
				   <td class="title_center"><a href="javascript:page_summary('orderby','assemblytype')">拼装类型</a></td>
				   <td class="title_center"><a href="javascript:page_summary('orderby','qtytype')">数量级别</a></td>
                 </tr> 
				 <%
                        String strClassType="";
                        int i = 0;
						HashMap hash = null; 
						String strVal = "";
                 %>
				 <logic:iterate id="onedetail" collection="<%= totalsummary %>" >
                 <%//show different colours in turns
                     if(i%2 == 1)
                         {
                             strClassType = "td-listrom";
                         }else{
                             strClassType = "none";
                         }
                     i++;
                 %>
					<tr onMouseOver="this.className='tr-over'" onMouseOut="this.className='<%= strClassType %>'"   class="<%= strClassType %>">
                         <td class="title_center"><input id="deleteids<%=JspHelper.filterNull(i)%>" name="deleteids" type="checkbox" value="<custom:write name="onedetail" property="batchnodataid"/>" class="normalradio"></td>
						 <td><custom:write name="onedetail" property="docdate" nbsp="true"/></td>
                         <td><custom:write name="onedetail" property="shipfromname" nbsp="true"/></td>
                         <td><custom:write name="onedetail" property="shiptoname" nbsp="true"/></td>
                         <td><custom:write name="onedetail" property="productname" nbsp="true"/></td>
                         <td><custom:write name="onedetail" property="spec" nbsp="true"/></td>
                         <td><custom:write name="onedetail" dictType="LogisticsType" property="batchnoype" nbsp="true"/></td>
                         <td><custom:write name="onedetail" property="batchno" nbsp="true"/></td>
						 <td><custom:write name="onedetail" property="datacode" nbsp="true"/></td>
						 <td><custom:write name="onedetail" dictType="PackagType" property="datatype" nbsp="true"/></td>
						 <td><custom:write name="onedetail" dictType="AssemblyType" property="assemblytype" nbsp="true"/></td>
						 <td><custom:write name="onedetail" dictType="QuantityLevel" property="qtytype" nbsp="true"/></td>
						 
						 <%
							String str1 = "batchnoype"+JspHelper.filterNull(i);
						    //String str2 = "userid"+JspHelper.filterNull(i);
						 %>
						 <custom:hidden name="onedetail" property="batchnoype" changedName="<%=str1 %>"/>
						 <custom:hidden name="onedetail" property="maker"  colIndex="<%=new Integer(i-1)%>"/>
                     </tr>
				 </logic:iterate>
                 <%@ include file="/inc/SummaryAction.inc" %>
		</table>
		</div>
	</td>
	</tr>
</table>
<table width="100%" cellspacing="0" cellpadding="0" border="0">
		<tr>
             <td colspan="2">
				 <table border="1" cellspacing="0" bordercolorlight="#999999" bordercolordark="#FFFFFF" align="center" width="100%" cellpadding="1">
					   <tr> 
							<td colspan="4" class="deepblue-left"><img src="<%=contextPath %>/images/cn/quote.gif"><%= "添加批号密码" + label.getLabelName("L_Colon") %></td>
					   </tr>
					   <tr>
                         <td class="need" width="20%"><%= label.getLabelName("L_LogisticsType") + label.getLabelName("L_Colon") %></td>
                         <td width="30%">
                            <custom:selectdic dictType="LogisticsType" property="batchnoype" defaultValue="------" command="notnull"  onchange="page_changeDisable()" label="L_LogisticsType" valueCriteria="2,3,4"/></td> 
                         </td>
						 <td class="need" width="20%"><%= label.getLabelName("L_Date") + label.getLabelName("L_Colon") %></td>
                         <td width="30%">
							<custom:text property="docdate" size="10" readonly="true" command="notnull" label="L_Date"/>
							<a onclick="javascript:if(cform.batchnoype.value==-1){return;}c.show(this,'cform.docdate','yyyy-MM-dd')"><input type=button class="button3" value="*"></a>
                         </td>
					   </tr>
					   <tr>
                         <td class="need"><%= label.getLabelName("L_OutSide") + label.getLabelName("L_Colon") %></td>
                         <td>
                             <custom:hidden property="shipfrom"/>
							 <custom:text property="shipfromcode" size="10" readonly="true" command="notnull" label="L_OutSide"/>
                             <a onclick="javascript:if(cform.batchnoype.value==-1){return;}frm_select(this,4);"><custom:button type="3" label="L_Asterisk" imgsrc="flash.gif" border="0"/></a>
                             <custom:text property="shipfromname" size="15" readonly="true"/>
                         </td>
						 <td class="need"><%= label.getLabelName("L_InSide") + label.getLabelName("L_Colon") %></td>
                         <td>
                             <custom:hidden property="shipto"/>
							 <custom:text property="shiptocode" size="10" readonly="true" command="notnull" label="L_InSide"/>
                             <a onclick="javascript:if(cform.batchnoype.value==-1){return;}frm_select(this,5);"><custom:button type="3" label="L_Asterisk" imgsrc="flash.gif" border="0"/></a>
                             <custom:text property="shiptoname" size="15" readonly="true" />
                         </td>
					   </tr>
					   <tr>
						 <td class="need"><%= label.getLabelName("L_Product") + label.getLabelName("L_Colon") %>
                         </td>
                         <td>
                             <custom:hidden property="productid"/>
							 <custom:text property="productcode" size="10" readonly="true" command="notnull" label="L_Product"/>
                             <a onclick="javascript:if(cform.batchnoype.value==-1){return;}frm_select(this,6);"><custom:button property="buttoner" type="3" label="L_Asterisk" imgsrc="flash.gif" border="0"/></a>
                             <custom:text property="productname" size="15" readonly="true" />
                         </td>
						 <td class="need"><%=label.getLabelName("L_PackageType") + label.getLabelName("L_Colon") %></td>
						 <td>
							<custom:selectdic dictType="PackagType" property="datatype" disabled='true' defaultValue="------" command="notnull" label="L_PackageType"/>
						 </td>
					   </tr>
					   <tr>
						 <td class="need"><%= label.getLabelName("L_QuantityLevel") + label.getLabelName("L_Colon") %></font></td>
                         <td>
                             <custom:selectdic dictType="QuantityLevel" property="qtytype" disabled='true' defaultValue="------" command="notnull" label="L_QuantityLevel"/></td>
                         </td>
						 <td class="td-text"><%="拼装类型" + label.getLabelName("L_Colon") %></td>
						 <td>
							<custom:selectdic dictType="AssemblyType" property="assemblytype" disabled='true' defaultValue="------"/></td>
						 </td>
                       </tr>
					   <tr>
						 <td class="need"><%=label.getLabelName("L_LotNumber") +  label.getLabelName("L_Colon") %></td>
						 <td>
							<custom:text property="batchno" size="20" readonly='true' onchange="check_bunchno()" label="L_LotNumber" command="notnull"/>&nbsp;&nbsp;<b id="bunchnoStr"></b>
						 </td>
						 <td class="td-text"><%=label.getLabelName("L_Rmark") + label.getLabelName("L_Colon") %></td>
						 <td>
							<custom:text property="remark" readonly='true' size="40"/>
						 </td>
                       </tr>
					   <tr>
						 <td class="need"><%=label.getLabelName("L_PassWordSupervis") + label.getLabelName("L_Colon") %></td>
						 <td>
							<custom:text property="datacodeF" size="20" readonly="true" onfocus="check_porscode()" onchange="check_porscode()" command="notnull" label="L_PassWordSupervis"/>&nbsp;&nbsp;<b id="porscodeStr"></b>
							<custom:hidden property="itmecode"/>
							<custom:hidden property="datacode"/>
						 </td><td colspan="2"><b id="errorStr"></b>&nbsp;</td>
                       </tr>
                 </table>
			</td>
		</tr>
	</table>
		<table width="100%" cellspacing="0">
	<tr>
        <td class="td_center">
			<custom:button type="1" label="L_Save" imgsrc="Modify.gif" border="0" onclick="page_save();" style="width:70"/>
        </td>
    </tr>
</table>
</form>	
</body>
<script>
function check_bunchno() 
{ 
	batchno = cform.batchno.value;
	if(batchno!=""){
		var patrn = /^[0-9]{7}$/; 
		var patrn3 = /^[0-9]{6}$/;
		if(!patrn.exec(batchno) && !patrn3.exec(batchno)) { 
			document.getElementById("bunchnoStr").innerHTML="<b style='color:red'>错误:批号格式应为6位或7位数字!</b>";
			pageflag=1;
		}else{
			document.getElementById("bunchnoStr").innerHTML="<b style='color:green'>正确批号格式</b>";
			pageflag=0;
		}
	}else{
		document.getElementById("bunchnoStr").innerHTML="";
	}
	
} 

function check_porscode() 
{ 
	porscode = cform.datacodeF.value;
	datatype = cform.datatype.value;
	productid = cform.productid.value;
	obj1 = cform.datatype;
	obj2 = cform.buttoner;
	if(datatype==-1 || productid=="" || productid==null){
		alert("请先选择产品和包装类型！");
		document.getElementById("porscodeStr").innerHTML="";
		if(productid=="" || productid==null){
			obj2.focus();
		}else{
			obj1.focus();
		}
		return;
	}
	if(datatype==4){
		if(porscode!=""){
			var patrn = /^[0-9]{7}$/; 
			if(!patrn.exec(porscode) ) { 
				document.getElementById("porscodeStr").innerHTML="<b style='color:red'>错误:密码格式应为7位数字!</b>";
				porsflag=1;
			}else{
				document.getElementById("porscodeStr").innerHTML="<b style='color:green'>正确密码格式</b>";
				porsflag=0;
				cform.itmecode.value=porscode.substr(0,5);
				page_getError();
			}
		}else{
			document.getElementById("porscodeStr").innerHTML="";
		}
	}else{
		if(porscode!=""){
			var patrn1 = /^[0-9]{20}$/; 
			var patrn2 = /^[0-9]{9}$/;
			if(!patrn1.exec(porscode) && !patrn2.exec(porscode)) { 
				document.getElementById("porscodeStr").innerHTML="<b style='color:red'>错误:监管码格式应为20位或简写9位数字!</b>";
				porsflag=1;
			}else{
				document.getElementById("porscodeStr").innerHTML="<b style='color:green'>正确监管码格式</b>";
				porsflag=0;
				if(patrn1.exec(porscode)) { 
					cform.itmecode.value=porscode.substr(0,5);
				}
				page_getError();
			}
		}else{
			document.getElementById("porscodeStr").innerHTML="";
		}
	}
	
} 

function page_changeDisable(){
	batchnoype = cform.batchnoype.value;
	if(batchnoype!=-1){
		cform.batchno.readOnly=false;
		cform.datacodeF.readOnly=false;
		cform.remark.readOnly=false; 
		cform.qtytype.disabled=false;
		cform.datatype.disabled=false;
		cform.assemblytype.disabled=false;
	}else{
		cform.docdate.value=""; cform.shipfromcode.value=""; cform.shipfromname.value=""; cform.shiptocode.value=""; cform.shiptoname.value=""; cform.productcode.value=""; cform.productname.value=""; cform.batchno.value=""; cform.datacodeF.value=""; cform.remark.value="";
		document.getElementById("bunchnoStr").innerHTML="";
		document.getElementById("porscodeStr").innerHTML="";
		cform.qtytype.value=-1;cform.datatype.value=-1;cform.assemblytype.value=-1;
		cform.batchno.readOnly=true;
		cform.datacodeF.readOnly=true;
		cform.remark.readOnly=true; 
		cform.qtytype.disabled=true;
		cform.datatype.disabled=true;
		cform.assemblytype.disabled=true;
	}
}
</script>
<script type="text/javascript">
var userid = cform.maker.value;
for(var i=0;i<cform.deleteids.length;i++){
	//alert(cform.deleteids.length +"=length");
	//alert(eval('cform.maker'+i).value +"=maker");
     if(eval('cform.maker'+i).value != userid){
    	 cform.deleteids[i].disabled=true;
     }
   }
</script>
</html>


